//////////////////////////////////////////////////////////////////////////
// FileName:WFHelper.cs
// CreateBy:Fenky
// CreateDate:2010-01-25
// Description:
//		Class WFHelper
//      
// Modify Log:20100302: Return a default value when not set FlowID --DragonXiong
//	
// Copyright:ASL-MIS
/////////////////////////////////////////////////////////////////////////
using System;
using System.Web;
using System.Web.UI;
using System.Text;
using System.IO;
using Auto.Components;
using System.Xml;

namespace Auto.Web.Common
{
    /// <summary>
    /// Work Flow
    /// </summary>
    public class WFHelper
    {
        /// <summary>
        /// Get Current Work Flow ID
        /// </summary>
        /// <returns></returns>
        public static string GetWorkFlowID
        {
            get
            {

                string sysID = SessionBox.CurrentSystem;
                string divID = SessionBox.User.DivID;
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.Load(HttpContext.Current.Server.MapPath("~/WorkFlow/WorkFlow.xml"));
                XmlNode node = xmlDocument.DocumentElement.SelectSingleNode(string.Format(@"//Page[@SysID='{0}'][@DivID='{1}'][@PageID='{2}']", sysID, divID, PathHelper.URL.ToLower()));
                string result = string.Empty;
                if (node != null)
                {
                    result = node.Attributes["WorkFlowID"].Value;
                }
                return result;
            }
        }
    }
}
